﻿@model PhoneBilling.Models.ExtensionMotionModel
@{
    ViewBag.Title = "部组管理";
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}
<script type="text/javascript" src="@Url.Content("~/Content/js/jquery.treeview.async.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Content/js/jquery.treeview.edit.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Content/js/jquery.treeview.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Content/js/jquery.treeview.sortable.js")"></script>
<link href="@Url.Content("~/Content/js/jquery.treeview.css")" rel="stylesheet" type="text/css" />

<script type="text/javascript">
    function selectDepartment(department) {
        $("#target").attr("value", department);
        
        $("span.file").removeClass("li-active");
        $("span.folder").removeClass("li-active");
        $("span.folder#" + department).addClass("li-active");
    }
    function selectGroup(group) {
        $("#target").attr("value",  group);

        $("span.folder").removeClass("li-active");
        $("span.file").removeClass("li-active");
        $("span.file#" + group).addClass("li-active");
    }
    $(document).ready(function () {
        $("#tree").treeview();
    });
  </script>

@using (Html.BeginForm())
{ 
    @Html.HiddenFor(m => m.GroupID)
    <div >
        <div class="col25">
        <h3 class="tlt">请选择要迁移的目的地</h3>
        @Html.HiddenFor(m => m.IsToSearch)
        <div>
            @Html.ValidationMessageFor(m => m.Target, new { style = "color:Red" })
        </div>
        <ul id="tree" class="treeview-gray">
     @{foreach (var department in Model.DepartmentList)
     {
        <li class="closed"><span class="folder" id="@department.ID" onclick="selectDepartment('@department.ID')">@department.名称</span> 
         
        @if(department.分组List.Count >0)
        {
        <ul>
            @{foreach (var group1 in department.分组List)
              {
                <li class="closed"><span class="file" id="@group1.ID" onclick="selectGroup('@group1.ID')">@group1.名称</span> 
            
                @if (group1.分组List.Count > 0)
                {
                <ul>
                    @{foreach (var group2 in group1.分组List)
                      {
                        <li class="closed"><span class="file" id="@group2.ID" onclick="selectGroup('@group2.ID')">@group2.名称</span> 
                
                        @if (group2.分组List.Count > 0)
                        {
                        <ul>
                            @{foreach (var group3 in group2.分组List)
                              {
                                <li><span class="file" id="@group3.ID" onclick="selectGroup('@group3.ID')">@group3.名称</span> 
                                </li>
                              }}
                        </ul>
                        }
                
                        </li>
                      }}
                </ul>
                }
                </li>
              }}
        </ul>
        }
        
        </li>
     }}
     </ul>
     </div>
     <div class="col75">
             @Html.HiddenFor(m => m.Target, new { id="target"})
             @Html.HiddenFor(m => m.IdList)
             <strong>要迁移的分机：</strong>
@{
    var grid = new WebGrid(source: Model.ExtensionList, rowsPerPage: 30);
}
@grid.GetHtml(
    alternatingRowStyle: "bg",
    columns:grid.Columns
    (
        grid.Column("分机号码","分机号码"),
        grid.Column("收费等级","收费等级"),
        grid.Column("费率","费率"),
        grid.Column("收费话类","收费话类"),
        grid.Column("报警限额","报警限额"),
        grid.Column("月杂费","月杂费"),
        grid.Column("用户名","用户名"),
        grid.Column("地址","地址"),
        grid.Column("分机功能","分机功能"),
        grid.Column("机架线号","机架线号"),
        grid.Column("安装日期","安装日期"),
        grid.Column("备注","备注")
    )
)
        <p class="submit">
            <input type="submit" value="确定" class="input-submit" />
        </p>
        </div>
        
    </div>
}

